package de.syfy.project.engine.hud;

import de.syfy.project.engine.hud.interfaces.UI_Container;
import static org.lwjgl.opengl.GL11.*;
import de.syfy.project.game.GamePanel;
import de.syfy.project.engine.TextureLoader;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author Timo
 */
public class Hud {
    private List<UI_Container> container;
    private GamePanel panel;
    
    public Hud(TextureLoader loader, GamePanel panel){
        this.panel = panel;
        initialize();
    }
    
    private void initialize(){
        this.container = new ArrayList<UI_Container>();
        initializeItems();
    }
    
    private void initializeItems(){
        Panel p = new Panel(panel,panel.getTextureLoader(),"panelTest.png",null,new Point2D.Float(200f,200f),1);
        Button b = new Button(panel);
        b.setPosition(new Point2D.Float(0,0));
        b.setSize(1000, 1000);
        container.add(p);
    }
    
    public void addContainer(UI_Container container){
        this.container.add(container);
        Collections.sort(this.container);
    }
    
    public void renderHud(){
        glColor3f(1f,1f,1f);
        for(UI_Container c:container){
            c.drawContainer();
        }
    }
}
